Dynomotion

Group: DynoMotion Message: 4883 From: gracemckay Date: 5/10/2012
Subject: Rotray encoder setup
Hi Tom,

I am still working on my scanner project. The current phase is incorporating a rotary encoder to sense film tension and control the speed of the take-up reel(axis2). I have added a photo of my wiring (in the scanner folder), based on a thread of a month ago about linear encoding. It is being seen by Kflop, but I am not sure if it it working correctly. I uploaded a video to the files/FilmScannerProject folder to show you the response I am getting. The range of motion of the encoder will be approximate 30 degrees. The A channel is set to I/O 4 , JP7 pin 11. The B channel to I/O 5 JP7 pin 12. But as you will see in the video, the encoder is switching bits 3, 4, 5 and 6. Is this proper behavior?
I suspect something is not quite right. What should my next steps be?

If this is correct, do you have a sample c-program that would be useful to use the encoder to control the axis2 speed?

Thanks!
Grace
Group: DynoMotion Message: 4904 From: Tom Kerekes Date: 5/11/2012
Subject: Re: Rotray encoder setup
Hi Grace,
 
JP7 Pins 11&12 would be encoder input 2.  You would need to conifigure an axis for Encoder Input and InputChan0=2. Then the Axis Screen should display the encoder position.  If you turn the encoder the encoder should count and if you turn the encoder back to where you started the count should return to the orignal value.  I wouldn't be concerned that other floating unused inputs toggle randomly.
 
I forget what type of amplifiers you have.  Open loop step/dir inputs I assume?
 
You might start with something simple like:
 
#include "KMotionDef.h"
#define FACTOR 1.0
main()
{
    double Target=ch2->Dest;
 
    for (;;)  // loop forever
    {
        WaitNextTimeSlice();
        // advance Target position smoothly
        // at rate determined by Encoder #2
        Target += FACTOR * ch2->Position;
  
        MoveExp(2,Target,0.1);
    }
}
 
Regards
TK